/*
 */
package gclib;

import gclib.Abilities.Ability;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

/**Toon.java
 * This is the class that encompasses anything that has direct connection with
 * or about someone in the game.
 * Created Jul 22, 2009 10:27:14 PM
 * @author Jason
 */
public class Toon {

	protected boolean creatingCharacter = false;
	protected boolean levelingCharacter = false;
	protected Set<Effect> effects;
	protected Map<String, Integer> VAR_MAP = new HashMap<String, Integer>();

    /** Every toon must have a name. */
    protected String name;
    protected Race myRace;

	protected Class myClass;
    /** Every toon must have a set of abilities. */
    protected Abilities abilities;

    /**The most basic constructor to build a <code>Toon</code>.
     * @param name
     */
    public Toon(String name){
        setName(name);
        abilities = new Abilities();
		abilities.getScore(Abilities.TYPE.STR);
    }

    /**Simple getter.
     * @return the name of the toon.
     * @see #setName(java.lang.String)
     */
    public String getName(){
        return name;
    }

    /**Simple getter.
     * @return the set of abilities.
     */
    public Abilities getAbilities(){
        return abilities;
    }

    /**Simple setter.
     * @param type sets the toon's race.
     */
    public void setRace(Races.TYPE type){
        myRace = Races.getRace(type);
		Ability ab;
		for(Entry<Abilities.TYPE, Integer> e:myRace.abilityBonusMap.entrySet()){
			ab = abilities.getAbility(e.getKey());
			ab.setRaceBonus(true);
			ab.setRaceBonusValue(e.getValue());
		}
    }

	int getStrMod(){
		int result = VAR_MAP.get("ABIL_STR_BASE");
		for(Effect effect:effects){
			if(effect.effectedValue.equalsIgnoreCase("ABIL_STR_BASE")){

			}
		}

		return result;
	}

    /**Will set the name of the toon to something other than <code>null</code> or
     * an empty string.
     * @param name The name of the toon.
     */
    private void setName(String name){
        if(name==null || name.isEmpty()){
            this.name = "<No Name>";
        }else{
            this.name = name;
        }
    }

    @Override
    public String toString(){
        return this.getClass().getSimpleName()+"[name:"+name+", race:"+myRace+"]";
    }
}
